package com.itheima.app.job;

import com.itheima.app.interceptor.UserHolder;
import com.itheima.domain.mongo.SoundTime;
import com.itheima.service.mongo.SoundTimeService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class SoundTimeJob {

    @Reference
    private SoundTimeService soundTimeService;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @Scheduled(cron = "0 0 0 1/1 * ?")
    public void soundTime(){
        System.out.println("更新数据...");

        stringRedisTemplate.opsForValue().set("sound_time" + UserHolder.get().getId(),10 + "");

    }
}
